FROM nginx
MAINTAINER lzx
VOLUME /tmp
ENV LANG en_US.UTF-8
RUN echo "server {  \
                      listen       80; \
        gzip on;\n\
        gzip_buffers 16 8k;\n\
        gzip_comp_level 6;\n\
        gzip_static on;\n\
                      location ^~ /api { \n\
                      proxy_pass              http://172.24.172.248:8088; \n\
                      proxy_set_header        Host data-flow; \n\
                      proxy_set_header        X-Real-IP \$remote_addr; \n\
                      proxy_set_header        X-Forwarded-For \$proxy_add_x_forwarded_for; \n\
                      rewrite ^/api/(.*)$ /\$1 break; \n\
                  } \n\
                  #解决Router(mode: 'history')模式下，刷新路由地址不能找到页面的问题 \n\
                  location / { \n\
                     root   /var/www/html/; \n\
                      index  index.html index.htm; \n\
                      if (!-e \$request_filename) { \n\
                          rewrite ^(.*)\$ /index.html?s=\$1 last; \n\
                          break; \n\
                      } \n\
                  } \n\
                  access_log  /var/log/nginx/access.log ; \n\
              } " > /etc/nginx/conf.d/default.conf \
    &&  mkdir  -p  /var/www \
    &&  mkdir -p /var/www/html

ADD dist/ /var/www/html/
EXPOSE 80
EXPOSE 443
